<?php

namespace app\common\model\give;

use app\common\model\User;
use think\Model;


class UserGive extends Model
{

    

    

    // 表名
    protected $name = 'user_give';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'user_txt',
        'to_user_id_txt'

    ];


    public function getUserTxtAttr($value, $data)
    {
        return User::where('id',$data['user_id'])->value('nickname');
    }

    public function getToUserIdTxtAttr($value, $data)
    {
        return User::where('id',$data['to_user_id'])->value('nickname');
    }

    







}
